package com.study.concurrent;

/**
 * Description:
 * User: 27010
 * DateTime: 2018/6/10 18:27
 */
public class Test {
    private int value;
    private volatile boolean flag = false;

    public void init(){
        value = 10;//语句1
        flag = true;//语句2
    }

    public void printInitValue(){
        if(flag){
            //期望值是10
            System.out.println(value);
        }
    }
}
